package a;

import java.sql.*;

public class FirstStep{
    public static void main(String args[]){
        int qty;
        float cost;
        String name;
        String desc;
        String query = "SELECT * FROM TEACHERS";
        String db = "HOMEWORK";
        String username = "root";
        String password = "winter";
        //String url = "jdbc:mysql://localhost/"
        String url = "jdbc:mysql://127.0.0.1:3306/"
                    + db +"?useUnicode=true&characterEncoding=utf-8";

        try{
            Class.forName("com.mysql.jdbc.Driver");
        }catch(ClassNotFoundException e){
            System.out.println("Could not found the driver class");
            e.printStackTrace();
        }
        try{
            //Class.forName("org.gjt.mm.mysql.Driver");
            Connection con = DriverManager.getConnection(url, username, password);
            //get a connection
            Statement stmt=con.createStatement();
            ResultSet rs = stmt.executeQuery(query);
	    resultSetMetaData md = ts.getMetaData();
	    int column = ts.getColumnCount();
            while(rs.next()){
		    for (int i = 0 ; i < column; i ++)
	    		    System.out.print();
            }
            con.close();
        }catch(SQLException e){
            System.out.println("Something wrong about the SQL\n" + e.toString());
            //e.printStackTrace();
        }
    }
}


